package com.nageoffer.shortLink.project.dao.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.nageoffer.shortLink.project.dao.entity.LinkStatsTodayDO;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;

public interface LinkStatsTodayMapper extends BaseMapper<LinkStatsTodayDO> {

    @Insert("INSERT INTO t_link_stats_today (full_short_url,gid,date,today_pv,today_uv,today_uip,create_time,update_time,del_flag) " +
            "VALUES(#{LinkStatsTodayDO.fullShortUrl},#{LinkStatsTodayDO.gid},#{LinkStatsTodayDO.date} " +
            ",#{LinkStatsTodayDO.todayPv},#{LinkStatsTodayDO.todayUv},#{LinkStatsTodayDO.todayUip},NOW(),NOW(),0) " +
            "ON DUPLICATE KEY UPDATE uv = uv + #{LinkStatsTodayDO.todayUv}, today_pv = today_pv +  #{linkTodayStats.todayPv}, today_uip = today_uip +  #{linkTodayStats.todayUip};")
    void shortLinkTodayState(@Param("linkTodayStats") LinkStatsTodayDO linkStatsTodayDO);

}
